// 空投商家相关接口

import {request} from "../utils/request";

// 获取商家列表
export async function getShops(data) {
	const res = await request({
		url: '/business/allBusiness',
		method: 'GET',
		data
	}).catch()
	return res
}


// 获取详细商家信息
export async function getDetailsShops(data) {
	const res = request({
		url: '/business/oneBusiness',
		method: 'GET',
		data
	}).catch()
	return res
}

// 收藏商家
export async function saveShop(data) {
	const res = await request({
	    url: `/business/saveBusiness`,
	    method: 'POST',
		header:{
		    'content-type':'application/x-www-form-urlencoded'
		},
	    data
	}).catch()
	return res
}

//查询商品
export async function getGoods(data) {
	const res = await request({
		url: `/goods`,
		method: 'GET',
		data
	}).catch()
	return res
}

//上传商品
export async function saveGoods(data) {
	const res = await request({
		url: `/goods`,
		method: 'POST',
		data
	}).catch()
	return res
}

//删除商品
export async function delGoods(data) {
	const res = await request({
		url: `/goods`,
		method: 'DELETE',
		header:{
			'content-type':'application/x-www-form-urlencoded'
		},
		data
	}).catch()
	return res
}

//修改商家信息
export async function editShop(data) {
	const res = await request({
		url: `/business/updateBusiness`,
		method: 'PUT',
		data
	}).catch()
	return res
}

//上传商家封面
export async function addShopImg(data) {
	const res = await request({
		url: `/businessImage`,
		method: 'POST',
		data
	}).catch()
	return res
}

//删除商家照片
export async function delShopImg(data) {
	const res = await request({
		url: `/businessImage`,
		method: 'DELETE',
		data
	}).catch()
	return res
}

// 获取商家标签
export async function getShopList(){
	const res = await request({
		url:"/userlabel/business",
		method:"get",
	}).catch()
	return res
}

// 修改商家标签
export async function UpdateShopList(data){
	const res = await request({
		url:"/userlabel/business",
		method:"put",
		data
	}).catch()
	return res
}